<template>
	<view class="goods_list">
			<view class="goods_item" v-for="item in goods" :key='item.id' @click="navigator"> 
				<image src='../../static/apple.jpg'></image>
				<view class="price">
					<text>￥{{item.sell_price}}</text>
					<text>￥{{item.market_price}}</text>
				</view>
				<view class="name">
					{{item.title}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		props:['goods'],//属性
		methods:{
			navigator(){
				this.$emit('goodsItemClick')
			}
	}
	}
	
</script>

<style lang="scss"> 
	.goods_list{
		margin: 0 15rpx;
		display: flex;
		flex-wrap: wrap;//根据自身项目宽度换行
		justify-content: space-between;//space-between左右两端对齐且项目之间间距相等
		.goods_item{
			background: #fff;
			width: 355rpx;
			margin: 10rpx 0;
			padding: 15rpx;
			box-sizing: border-box;//c3盒子模型 边框和内边距不会撑大盒子
			image{
				display: block;//image默认是行内块元素
				width: 80%;
				height: 150px;
				margin: 0 auto;
			}
			.price{
				color: $shop-color;
				font-size: 36rpx;
				margin: 20rpx 0 5rpx 0;
				text:nth-child(2){//单独设置text的第二个子元素
					color: #ccc;
					font-size: 28rpx;
					margin-left: 17rpx;
					text-decoration: line-through;
				}
				
			}
			.name{
				font-size: 28rpx;
				line-height: 50rpx;
				padding-top: 10rpx;
				padding-bottom: 15rpx;
			
			}
		}
	}
</style>
